home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: hafshar@aol.com (HAfshar)
- Newsgroups: comp.lang.c++
- Subject: Help - problem with fstream and random-access files
- Date: 12 Mar 1996 12:54:03 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4i4dnr$ld2@newsbf02.news.aol.com>
- Reply-To: hafshar@aol.com (HAfshar)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- Hello,
-
- I'm trying to create a random-access file of fixed-length records. Each
- record (struct) has a couple of integers and a couple of arrays of
- characters. I initialize the file with zero for each field, since the
- number of records in the file is fixed and I would like to return zero for
- access to a record that has not yet been written.
-
- I start out writing records to the file and everything seems okay but when
- I try to read back the records and print them to the screen or to a file,
- the first 9 read back unexpected values (but formatted correctly). After
- that, the 10th record seems to be corrupted, and then the file seems to
- get back in synch again.
-
- I stepped the program through a debugger and noticed that the get and put
- file pointers seem to be at an unexpected location (for example I expect
- the next record to be at address 0x400 but "tellg" tells me that it is
- actually at 0x402.
-
- Does anyone have any ideas?
-
- Thanks,
-
- Harry
- PS> I'm using Borland v4.02
-